package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.KsOrder;
import com.ruoyi.system.mapper.KsOrderMapper;
import com.ruoyi.system.service.IKsOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 客诉工单Service业务层处理
 *
 * @author hjf
 * @date 2025-07-10
 */
@Service
public class KsOrderServiceImpl implements IKsOrderService {
    @Autowired
    private KsOrderMapper ksOrderMapper;

    /**
     * 查询客诉工单
     *
     * @param id 客诉工单主键
     * @return 客诉工单
     */
    @Override
    public KsOrder selectKsOrderById(Long id) {
        return ksOrderMapper.selectKsOrderById(id);
    }

    /**
     * 查询客诉工单列表
     *
     * @param ksOrder 客诉工单
     * @return 客诉工单
     */
    @Override
    public List<KsOrder> selectKsOrderList(KsOrder ksOrder) {
        return ksOrderMapper.selectKsOrderList(ksOrder);
    }

    /**
     * 新增客诉工单
     *
     * @param ksOrder 客诉工单
     * @return 结果
     */
    @Override
    public int insertKsOrder(KsOrder ksOrder) {
        ksOrder.setCreateTime(DateUtils.getNowDate());
        return ksOrderMapper.insertKsOrder(ksOrder);
    }

    /**
     * 修改客诉工单
     *
     * @param ksOrder 客诉工单
     * @return 结果
     */
    @Override
    public int updateKsOrder(KsOrder ksOrder) {
        ksOrder.setUpdateTime(DateUtils.getNowDate());
        return ksOrderMapper.updateKsOrder(ksOrder);
    }

    /**
     * 批量删除客诉工单
     *
     * @param ids 需要删除的客诉工单主键
     * @return 结果
     */
    @Override
    public int deleteKsOrderByIds(Long[] ids) {
        return ksOrderMapper.deleteKsOrderByIds(ids);
    }

    /**
     * 删除客诉工单信息
     *
     * @param id 客诉工单主键
     * @return 结果
     */
    @Override
    public int deleteKsOrderById(Long id) {
        return ksOrderMapper.deleteKsOrderById(id);
    }
}
